package com.hysf.configs;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@EnableWebMvc // 开启WebMvc
public class WebConfig implements WebMvcConfigurer {
	/*
	* 当访问/static/**时，会映射到classpath:/static/目录下
	* */
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		// 配置静态资源的访问路径
		registry.addResourceHandler("/**")
				// 配置静态资源的物理路径
				.addResourceLocations("classpath:/static/");
	}
}
